<?php

namespace Models;

use Phalcon\Db\RawValue;

class Log extends BaseModel {


    public function beforeValidationOnCreate()
    {
        if (!isset($this->comment) || !$this->comment) {
            $this->comment = new RawValue('default');
        }
    }

    public function beforeValidationOnUpdate()
    {
        if (!isset($this->comment) || !$this->comment) {
            $this->comment = new RawValue('default');
        }
    }

    public function notSave()
    {
        //Obtain the flash service from the DI container
        $flash = $this->getDI()->getFlash();

        //Show validation messages
        foreach ($this->getMessages() as $message) {
            $flash->error($message);
        }
    }  

}